var o = getApp();

Page({
    data: {
        sum: 1
    },
    onLoad: function(o) {
        o.id && this.setData({
            goods_id: o.id
        }), this.getData();
    },
    onChange: function(o) {
        console.log(o), this.setData({
            sum: o.detail
        });
    },
    goOrder: function(o) {
        var t = o.currentTarget.dataset.id, a = o.currentTarget.dataset.key, e = o.currentTarget.dataset.ind;
        this.data.sum > this.data.info.deposit_stock ? wx.showToast({
            title: "库存不足",
            icon: "none",
            duration: 1e3
        }) : wx.navigateTo({
            url: "/packageE/others/cloudwarehouse/cloudOrder/cloudOrder?tag=" + a + "&goodsId=" + t + "&optionsId=&total=" + this.data.sum + "&is_selected=" + e
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    getData: function() {
        var t = this, a = o.getNetAddresss("plugin.cloud-warehouse.frontend.warehouse-goods-manage.warehouse-goods-info");
        o._getNetWork({
            url: a,
            data: {
                goods_id: t.data.goods_id
            },
            success: function(o) {
                var a = o.data;
                1 == a.result ? (console.log(a), t.setData({
                    info: a.data
                })) : wx.showToast({
                    icon: "none",
                    title: a.msg,
                    duration: 1500
                });
            },
            fail: function(o) {
                console.log(o);
            }
        });
    },
    shiftTo: function() {
        var t = o.getNetAddresss("plugin.cloud-warehouse.frontend.warehouse-goods-manage.moving-to-seal");
        o._getNetWork({
            url: t,
            data: {
                goods_id: this.data.goods_id,
                sum: this.data.sum
            },
            success: function(o) {
                var t = o.data;
                1 == t.result ? (console.log(t), wx.showToast({
                    title: t.msg,
                    icon: "none",
                    duration: 1e3,
                    success: function() {
                        wx.navigateBack({
                            delta: 1
                        });
                    }
                })) : wx.showToast({
                    icon: "none",
                    title: t.msg,
                    duration: 1500
                });
            },
            fail: function(o) {
                console.log(o);
            }
        });
    }
});